package com.furongji.education.fallback;

import com.furongji.common.result.Result;
import com.furongji.education.clients.VodFeignClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Slf4j
public class VodFeignClientFallback implements FallbackFactory<VodFeignClient> {
    @Override
    public VodFeignClient create(Throwable cause) {
        return new VodFeignClient() {
            @Override
            public Result removeVideo(String id) {
                log.error("远程调用删除视频异常");
                return Result.error();
            }

            @Override
            public Result removeVideoList(List<String> videoIdList) {
                log.error("远程调用批量删除视频异常");
                return Result.error();
            }
        };
    }
}
